package threading;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author krystal
 * @date 2022/11/25 10:21
 */
public class Demo24 {
    public static void main(String[] args) {
        Timer timer=new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("时间到了，快起床");
            }
        },3000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("时间到了，快起床1");
            }
        },4000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("时间到了，快起床2");
            }
        },5000);
        System.out.println("开始计时");
    }
}
